Method and device for determining handwriting similarity

ABSTRACT

The present disclosure provides a method and device for determining a handwriting similarity. The method includes: performing image processing on a handwriting image comprising a handwriting to be compared to obtain a first processed image and a second processed image having different handwriting features of the handwriting image; determining, based on the first processed image, a first feature vector indicating at least one first handwriting feature of the handwriting to be compared; determining, based on the second processed image, a second feature vector indicating at least one second handwriting feature of the handwriting to be compared; determining a handwriting feature vector of the handwriting to be compared based at least on the first feature vector and the second feature vector; and determining a similarity between the handwriting to be compared and a reference handwriting based on the handwriting feature vector and a reference handwriting feature vector of the reference handwriting.

CROSS-REFERENCE TO RELATED APPLICATION(S)

The present application claims priority to the Chinese PatentApplication CN201811400058.X, filed on Nov. 22, 2018, entitled “METHODAND APPARATUS FOR DETERMINING QUALITY LEVEL OF WRITTEN FONTS”, which isincorporated herein by reference in its entirety.

TECHNICAL FIELD

The present disclosure relates to the field of image processingtechnologies, and more particularly, to a method and device fordetermining a handwriting similarity.

BACKGROUND

Calligraphy is the cultural treasure of the Chinese nation. Calligraphyeducation has a subtle influence on the inheritance and development ofChinese excellent traditional culture and the cultivation of a youngergeneration with higher cultural quality. Many people need a lot ofcalligraphy practice to achieve desired effects because of their hobbiesor professional needs. In real life, the most common way of calligraphypractice is copybook imitation on, for example, a paper, or imitationpractice on an electronic writing screen.

However, in practical applications, many calligraphy practicers takepractices in the absence of professional instructors after calligraphyclasses, and therefore, it is often difficult for the calligraphypracticers to professionally determine whether they make standardwriting, which may lead to repetition and ineffectiveness of thepractices, and a waste of time and energy of the calligraphy practicers,thereby reducing the efficiency of the calligraphy practices.

SUMMARY

According to some embodiments of the present disclosure, there isproposed a computer implemented method for determining a handwritingsimilarity. The method comprises: performing image processing on ahandwriting image comprising a handwriting to be compared to obtain afirst processed image and a second processed image having differenthandwriting features of the handwriting image; determining, based on thefirst processed image, a first feature vector indicating at least onefirst handwriting feature of the handwriting to be compared;determining, based on the second processed image, a second featurevector indicating at least one second handwriting feature of thehandwriting to be compared; determining a handwriting feature vector ofthe handwriting to be compared based on the first feature vector and thesecond feature vector at least; and determining a similarity between thehandwriting to be compared and a reference handwriting based on thehandwriting feature vector and a reference handwriting feature vector ofthe reference handwriting.

In some embodiments, the step of determining a similarity between thehandwriting to be compared and a reference handwriting based on thehandwriting feature vector and a reference handwriting feature vector ofthe reference handwriting comprises: determining a distance parameterbetween the handwriting feature vector and the reference handwritingfeature vector; and determining the similarity between the handwritingto be compared and the reference handwriting based on the distanceparameter.

In some embodiments, the distance parameter comprises a Euclideandistance or a Mahalanobis distance between the vectors.

In some embodiments, the reference handwriting feature vector of thereference handwriting is determined by performing image processing onthe reference handwriting image comprising the reference handwriting toobtain a third processed image and a fourth processed image havingdifferent handwriting features of the reference handwriting image;determining, based on the third processed image, a third feature vectorindicating a corresponding first handwriting feature of the referencehandwriting; determining, based on the fourth processed image, a fourthfeature vector indicating a corresponding second handwriting feature ofthe reference handwriting; and determining a reference handwritingfeature vector of the reference handwriting based at least on the thirdfeature vector and the fourth feature vector.

In some embodiments, the step of performing image processing on ahandwriting image comprising a handwriting to be compared to obtain afirst processed image and a second processed image having differenthandwriting features of the handwriting image comprise: converting thehandwriting image into a corresponding binarized handwriting image;determining, in the binarized handwriting image, a quadrilateral regioncomprising the handwriting to be compared; performing perspectivetransformation on the quadrilateral region to obtain a corrected region;performing erosion processing on the corrected region to obtain thefirst processed image comprising a skeleton of the handwriting to becompared; and de-noising the corrected region to obtain the secondprocessed image.

In some embodiments, the step of determining a handwriting featurevector of the handwriting to be compared based at least on the firstfeature vector and the second feature vector comprises: determining aweighted sum of the first feature vector and the second feature vectorbased on preset weights, as the handwriting feature vector.

In some embodiments, the first feature vector comprises at least one ofan inner contour feature vector and a perimeter and area feature vector.

In some embodiments, the second feature vector comprises at least one ofan outer contour feature vector and a style feature vector.

In some embodiments, the step of determining, based on the firstprocessed image, a first feature vector indicating at least one firsthandwriting feature of the handwriting to be compared comprises at leastone of: determining, from the first processed image, an area of a regionbetween a first stroke and a second stroke in at least one presetdirection as the inner contour feature vector; or determining a fontcontour perimeter and a font area of the first processed image to obtainthe perimeter and area feature vector.

In some embodiments, the step of determining, based on the secondprocessed image, a second feature vector indicating at least one secondhandwriting feature of the handwriting to be compared comprises at leastone of: extracting a font style feature of the second processed imagebased on a convolutional neural network to obtain the style featurevector; or determining, from the second processed image, an area of aregion between an edge of a first target corrected region and a firststroke in at least one of the preset directions to obtain the outercontour feature vector.

According to some other embodiments of the present disclosure, there isproposed a device for determining a handwriting similarity. The devicecomprises: a processor; and a memory having stored thereon instructionswhich, when executed by the processor, cause the processor to: performimage processing on a handwriting image comprising a handwriting to becompared to obtain a first processed image and a second processed imagehaving different handwriting features of the handwriting image;determine, based on the first processed image, a first feature vectorindicating at least one first handwriting feature of the handwriting tobe compared; determine, based on the second processed image, a secondfeature vector indicating at least one second handwriting feature of thehandwriting to be compared; determine a handwriting feature vector ofthe handwriting to be compared based on the first feature vector and thesecond feature vector at least; and determine a similarity between thehandwriting to be compared and a reference handwriting based on thehandwriting feature vector and a reference handwriting feature vector ofthe reference handwriting.

In some embodiments, the instructions which, when executed by theprocessor, further cause the processor to: determine a distanceparameter between the handwriting feature vector and the referencehandwriting feature vector; and determine the similarity between thehandwriting to be compared and the reference handwriting based on thedistance parameter.

In some embodiments, the distance parameter comprises a Euclideandistance or a Mahalanobis distance between the vectors.

In some embodiments, the instructions which, when executed by theprocessor, further cause the processor to: perform image processing onthe reference handwriting image comprising the reference handwriting toobtain a third processed image and a fourth processed image havingdifferent handwriting features of the reference handwriting image;determine, based on the third processed image, a third feature vectorindicating a corresponding first handwriting feature of the referencehandwriting; determine, based on the fourth processed image, a fourthfeature vector indicating a corresponding second handwriting feature ofthe reference handwriting; and determine a reference handwriting featurevector of the reference handwriting based at least on the third featurevector and the fourth feature vector.

In some embodiments, the instructions which, when executed by theprocessor, further cause the processor to: convert the handwriting imageinto a corresponding binarized handwriting image; determine, in thebinarized handwriting image, a quadrilateral region comprising thehandwriting to be compared; perform perspective transformation on thequadrilateral region to obtain a corrected region; perform erosionprocessing on the corrected region to obtain the first processed imagecomprising a skeleton of the handwriting to be compared; and de-noisethe corrected region to obtain the second processed image.

In some embodiments, the instructions which, when executed by theprocessor, further cause the processor to: determine a weighted sum ofthe first feature vector and the second feature vector based on presetweights, as the handwriting feature vector.

In some embodiments, the first feature vector comprises at least one ofan inner contour feature vector and a perimeter and area feature vector.

In some embodiments, the second feature vector comprises at least one ofan outer contour feature vector and a style feature vector.

In some embodiments, the instructions which, when executed by theprocessor, further cause the processor to perform at least one of:determining, from the first processed image, an area of a region betweena first stroke and a second stroke in at least one preset direction asthe inner contour feature vector; or determining a font contourperimeter and a font area of the first processed image to obtain theperimeter and area feature vector.

According to still some other embodiments of the present disclosure,there is proposed a non-transitory computer readable storage medium. Thecomputer readable storage medium has stored thereon a computer programwhich, when executed by a processor, implement the steps of the methoddescribed above.

BRIEF DESCRIPTION OF THE DRAWINGS

The above and/or other aspects, features and attendant advantages of thepresent disclosure will become more apparent and clear from thefollowing detailed description in conjunction with the accompanyingdrawings. In the accompanying drawings, the same reference signsrepresent the same elements, and in the accompanying drawings,

FIG. 1 illustrates a flowchart of steps of a method for determining aquality level of a written font according to an embodiment of thepresent disclosure;

FIG. 2 illustrates a flowchart of steps of a method for determining aquality level of a written font according to another embodiment of thepresent disclosure;

FIG. 3 illustrates a schematic diagram of scanning a first processedimage downward and leftward according to another embodiment of thepresent disclosure;

FIG. 4 illustrates a schematic diagram of scanning a second processedimage downward and leftward according to another embodiment of thepresent disclosure;

FIG. 5 illustrates a schematic structural diagram of an apparatus fordetermining a quality level of a written font according to still anotherembodiment of the present disclosure;

FIG. 6 illustrates a schematic structural diagram of an extractionsub-module according to still another embodiment of the presentdisclosure; and

FIG. 7 illustrates a hardware arrangement diagram of a device fordetermining a handwriting similarity according to an embodiment of thepresent disclosure.

DETAILED DESCRIPTION

In order to make the above purposes, features and advantages of thepresent disclosure more obvious and understandable, the presentdisclosure will be described in more detail below with reference to theaccompanying drawings and specific implementations. Since variouschanges and many embodiments are allowed in the present disclosure,exemplary embodiments will be illustrated in the accompanying drawingsand described in detail in the present disclosure. However, it is notintended to limit the present disclosure to the specific embodiments,and it is to be understood that the present disclosure covers allchanges, equivalents and/or alternatives without departing from thespirit and scope of the present disclosure. In the present disclosure,certain detailed explanations in the related art are omitted when theyare considered to unnecessarily obscure the substance of the presentdisclosure.

As used herein, singular forms “one”, “an” and “the” may comprise pluralreferents, unless explicitly stated in the context. In the presentdisclosure, terms “comprises” or “configured to” etc. means that thereare features, quantities, steps, operations, components, parts, or acombination thereof, but do not exclude the presence or addition of oneor more features, quantities, steps, operations, components, parts orcombination thereof.

In various exemplary embodiments of the present disclosure, terms suchas “module,” “unit,” “part,” etc. are terms used to designate acomponent which performs at least one function or operation. Thiscomponent may be implemented as hardware, software, or any combinationthereof. A plurality of “modules,” “units,” “parts,” etc. may beintegrated into at least one module or chip and implemented as at leastone processor, which does not comprise a case where each of the“modules,” “units,” “parts,” etc. must be implemented as a separatespecific hardware.

Hereinafter, the present disclosure will be described in more detailwith reference to the accompanying drawings. Exemplary embodiments ofthe present disclosure are illustrated in the accompanying drawings.However, the present disclosure may be embodied in many different formsand should not be construed as being limited to the exemplaryembodiments set forth herein. On the contrary, these exemplaryembodiments are provided to make the present disclosure comprehensiveand complete, and convey the concept of the present disclosure to thoseof ordinary skill in the art. Further, when the present disclosure isdescribed, a detailed description of related well-known functions orconfigurations which may obscure the substance of the present disclosuremay be omitted.

It is to be illustrated that although a solution of determining ahandwriting similarity according to an embodiment of the presentdisclosure is mainly described herein in an application scenario inwhich a quality level of a handwriting is determined relative to astandard font, the embodiment of the present disclosure is not limitedthereto. In fact, in addition to determining the quality level of thehandwriting by determining a similarity between the handwriting and thestandard font, it is also possible to apply the solution according tothe embodiment of the present disclosure to determining a similaritybetween the handwriting to be compared and any reference handwriting.For example, in a process of determining legality of a contract, thesolution according to the embodiment of the present disclosure may beused to determine whether a handwriting of a signature on a disputecontract is written by oneself in person. In other words, the solutionaccording to the embodiment of the present disclosure may be applied aslong as there is a scenario in which a handwriting similarity needs tobe determined.

Hereinafter, various exemplary embodiments of the present disclosurewill be described in more detail with reference to the accompanyingdrawings.

As shown in FIG. 1, illustrated is a flowchart of steps of a method fordetermining a quality level of a written font based on a handwritingsimilarity according to some embodiments of the present disclosure. Themethod comprises the following steps.

In step 101, a target word image is acquired.

In some embodiments, a user may write a target word on a paper, and thenphotographs the target word through a photographing device to obtain thetarget word image, which is then transmitted from the photographingdevice to a processing terminal. Alternatively, after the user writesthe target word on the paper, a processing terminal having aphotographing function may photograph the target word directly, so as toobtain the target word image.

In some other embodiments, the user may write the target word directlyon an electronic screen of a processing terminal through an electronicpen, so that the processing terminal may generate the target word imageaccording to a detected touch trajectory on the screen. In addition, instill some other embodiments, the user may also read a pre-stored targetword image (which is, for example, transmitted by a third party througha network and is stored in a local memory, or is acquired byphotographing at an earlier time and is stored for later use) to acquirethe target word image.

In step 102, the target word image is pre-processed to obtain a firstprocessed image and a second processed image.

After the processing terminal acquires the target word image, theprocessing terminal may cut a target quadrilateral region, i.e., thesmallest quadrilateral region comprising the target word, from thetarget word image, and then perform correction (for example, perspectivetransformation) on the target quadrilateral region, so as to eliminate aview difference due to the user's photographing angle. After thecorrection is performed, a skeleton of the target word may bedetermined, so as to obtain the first processed image comprising theskeleton of the target word. In addition, after the correction isperformed, the corrected target quadrilateral region may further bede-noised, so as to obtain the de-noised second processed image.Further, in some other embodiments, other image processing may also beperformed on the target word image to obtain the first processed imageand the second processed image having different handwriting features.

In step 103, writing feature extraction is performed on the firstprocessed image and the second processed image, to obtain a handwritingfeature vector.

After the processing terminal obtains the first processed imagecomprising the skeleton of the target word and the de-noised secondprocessed image, different feature vectors may be extracted from thefirst processed image and the second processed image respectively, andthe extracted feature vectors are synthesized to obtain a handwritingfeature vector comprising different features of the target word.

In step 104, a difference parameter (or equivalently, similarity)between the handwriting feature vector and a reference handwritingfeature vector corresponding to a standard word image (or a referencehandwriting image) is determined.

After the processing terminal obtains the handwriting feature vector,the difference parameter between the handwriting feature vector and thereference handwriting feature vector corresponding to the standard wordimage may be determined. Here, a standard word in the standard wordimage is the same as the target word, for example, if the target word is“

” written by the user, the standard word is “

” stored by the processing terminal as a writing standard. In addition,the reference handwriting feature vector corresponding to the standardword image may be determined in the same manner as that of thehandwriting feature vector corresponding to the target word image, andthe reference handwriting feature vector may be determined in advanceand stored in the processing terminal, or may of course be determined ina process of determining a quality level of the written font, which isnot specifically limited in the embodiments of the present disclosure.Further, as described above, in some other embodiments, the standardword image is not necessarily used as an object for determining thesimilarity, and another image written by, for example, the same writermay be used as the object for determining the similarity. So far, thepurpose of determining a handwriting similarity has been achieved byusing the method for determining a handwriting similarity, and a nextstep is an additional optional step for specific application ofdetermining a writing quality level.

In step 105, a writing quality level corresponding to the differenceparameter (or similarity) is determined.

The processing terminal may store at least two writing quality levels,and a difference parameter (or similarity) range corresponding to eachof the writing quality levels in advance, and after the processingterminal determines the difference parameter between the first featurevector and the second feature vector, the processing terminal maydetermine a difference parameter range to which the difference parameterbelongs, so as to determine a writing quality level corresponding to thedifference parameter range, that is, a degree of imitation of the targetword relative to the standard word. In practical applications, thesmaller the difference parameter between the first feature vector andthe second feature vector is, the more similar the target word is to thestandard word, that is, the more standard writing the user makes.

In the embodiment of the present disclosure, after the processingterminal acquires the target word image, the processing terminal mayfirstly pre-process the target word image to obtain the first processedimage and the second processed image, and then may perform writingfeature extraction on the first processed image and the second processedimage to obtain the first feature vector, so as to determine thedifference parameter between the first feature vector and the secondfeature vector corresponding to the standard word image, and determinethe writing quality level corresponding to the difference parameter. Inthe embodiment of the present disclosure, the processing terminal mayextract writing features of the target word image and compare thewriting features of the target word image with writing features of thestandard word image, so as to determine a writing quality level of thetarget word image relative to the standard word image. In this way, theprocessing terminal may determine a quality level of a written font of acalligraphy practitioner, so as to provide professional guidance to thecalligraphy practitioner, thereby improving the efficiency of thecalligraphy practice.

As shown in FIG. 2, illustrated is a flowchart of steps of a method fordetermining a quality level of a written font based on a handwritingsimilarity according to some other embodiments of the presentdisclosure. The method comprises the following steps.

In step 201, a target word image is acquired.

An implementation of this step is similar to that of step 101 describedabove, and will not be described in detail herein.

In step 202, the target word image is pre-processed to obtain a firstprocessed image and a second processed image.

In the embodiment of the present disclosure, the step may be implementedby acquiring a target binarized image corresponding to the target wordimage; determining, in the target binarized image, a targetquadrilateral region comprising a target word; performing perspectivetransformation on the target quadrilateral region to obtain a targetcorrected region; performing erosion processing on the target correctedregion to obtain the first processed image comprising a skeleton of thetarget word; and de-noising the target corrected region to obtain thesecond processed image.

In some embodiments, the processing terminal may acquire a targetgrayscale image corresponding to the target word image, and then mayperform binarization processing on the target grayscale image, to obtainthe target binarized image. For example, for an 8-bit target grayscaleimage, binarization processing may be performed on the 8-bit targetgrayscale image using a threshold of 150. Then, the processing terminalmay scan the target binarized image in four directions of upwarddirection, downward direction, leftward direction, and rightwarddirection respectively, and when a first pixel is scanned in eachdirection, a position of a scanning line is recorded, and then a regionenclosed by four scanning lines is determined to be the targetquadrilateral region comprising the target word. In practicalapplications, when a user photographs the target word image, a lens isusually difficult to be kept in parallel to a desktop where a paper islocated. Therefore, the photographed target word image is actuallyslightly distorted and may not be used for comparison. Therefore, theprocessing terminal may perform perspective transformation on the targetquadrilateral region to obtain a rectangular target corrected region,thereby eliminating a view difference caused by the user's photographingangle.

Here, the step of performing perspective transformation on the targetquadrilateral region by the processing terminal may be known withreference to any existing perspective transformation method, forexample, a perspective transformation method based on a Line SegmentDetector (LSD), which may firstly perform LSD line detection, thendivide pixels into a group of horizontal pixels and a group of verticalpixels, then combine lines which are approximately parallel to eachother to determine optimal boundaries and vertices, and performperspective transformation, and will not be described in detail hereinin the embodiments of the present disclosure.

After the processing terminal obtains the target corrected region, theprocessing terminal may perform two processes on the target correctedregion respectively, to obtain two different images having differenthandwriting features, so as to extract different font features from thetwo different images. In an implementation, the processing terminal mayobtain the first processed image comprising the skeleton of the targetword by using the following sub-steps (1) to (5).

In sub-step (1), initial contour points of the target word in the targetcorrected region are determined, and erosion processing is performed onthe initial contour points sequentially using all 3-connected pixelstructures, to obtain a first pattern.

In sub-step (2), contour points of the first pattern are determined, anderosion processing is performed on the contour points of the firstpattern sequentially using all 4-connected pixel structures, to obtain asecond pattern.

In sub-step (3), contour points of the second pattern are determined,and erosion processing is performed on the contour points of the secondpattern sequentially using all 5-connected pixel structures, to obtain athird pattern.

In sub-step (4), contour points of the third pattern are determined, anderosion processing is performed on the contour points of the thirdpattern sequentially using all 6-connected pixel structures, to obtain afour pattern.

In sub-step (5), contour points of the fourth pattern are determined,and erosion processing is performed on the contour points of the fourthpattern sequentially using all 7-connected connected pixel structures,to obtain the first processed image comprising the skeleton of thetarget word.

Here, the processing terminal may firstly perform preliminary erosionprocessing on the initial contour points of the target word throughsmall pixel structures, and then sequentially perform further erosionprocessing on a pattern obtained by previous erosion processing throughlarger pixel structures, so as to obtain the skeleton of the targetword, in which main structural features of the target word are retained.It should be illustrated that the processing terminal may obtain thefirst processed image comprising the skeleton of the target word in theabove implementation, i.e., performing five erosion processes, whereindifferent pixel structures are used in various erosion processes. Ofcourse, in practical applications, a number of erosion processes andwhether the same pixel structures are used in various erosion processesare not specifically limited. For example, three or four erosionprocesses may be performed, and 3-connected pixel structures are used ineach erosion process, etc., which is not specifically limited in theembodiments of the present disclosure.

In addition, after the processing terminal obtains the target correctedregion, the processing terminal may perform a first predetermined numberof erosion processes on the target corrected region to retain detailedinformation of the target word, and then perform a second predeterminednumber of dilation processes on the eroded image to enhance overallinformation of the target word, so as to achieve de-noising of thetarget corrected region, to obtain the second processed image.

In step 203, writing feature extraction is performed on the firstprocessed image and the second processed image, to obtain a handwritingfeature vector.

In the embodiment of the present disclosure, the present step may beimplemented by: extracting writing features of the first processed imageand the second processed image to obtain a writing feature vector; andobtaining a handwriting feature vector according to a product of thewriting feature vector and preset weights, wherein the writing featurevector may comprise, but not limited to, a style feature vector and atleast two of an inner contour feature vector, a perimeter and areafeature vector, and an outer contour feature vector.

Specifically, an implementation of the method for extracting writingfeatures of the first processed image and the second processed image toobtain a writing feature vector may comprise:

extracting a font style feature of the second processed image based on aconvolutional neural network to obtain the style feature vector, and

at least two of:

(2) determining, from the first processed image, an area of a regionbetween a first stroke and a second stroke in at least one presetdirection to obtain the inner contour feature vector,

(3) determining a font contour perimeter and a font area of the firstprocessed image, to obtain the perimeter and area feature vector, and

(4) determining, from the second processed image, an area of a regionbetween an edge of a first target corrected region and the first strokein at least one preset direction to obtain the outer contour featurevector.

In other words, in the above embodiment, at least one of the innercontour feature vector and the perimeter and area feature vector of thefirst processed image may be extracted as the first feature vectorindicating the first handwriting feature of the target word. Further, inthe above embodiment, the font style feature of the second processedimage may be extracted, and the outer contour feature vector may beoptionally extracted as the second feature vector indicating the secondhandwriting feature of the target word.

In the above step (1), a trained convolutional neural network for fontstyle classification, such as a VGG-19 model, may be preset in advancein the processing terminal, and then the second processed image may beinput into the VGG-19 model, so as to obtain a first output resultthrough a first convolutional layer of the VGG-19 model, obtain a secondoutput result through a second convolutional layer of the VGG-19 model,obtain a third output result through a third convolutional layer of theVGG-19 model, and obtain a fourth output result through a fourthconvolutional layer of the VGG-19 model. A four-dimensional vectorformed by the four output results is the style feature vector Se1 of thetarget word. Here, the VGG-19 model in the embodiment of the presentdisclosure may be constructed and trained with reference to existingmethods, for example, methods in the paper “Perceptual Losses forReal-Time Style Transfer and Super-Resolution ” etc., and will not bedescribed in detail herein.

It should be illustrated that, since an execution order of the abovesteps (1) to (4) is not limited, step (1) may be performed after steps(2), (3) and (4). In this case, the processing terminal may input thesecond processed image and at least two of the inner contour featurevector, the perimeter and area feature vector and the outer contourfeature vector into the VGG-19 model as an input set, so as to obtainthe style feature vector Se1 of the target word. A data source which isinput into the VGG-19 model is not specifically limited in theembodiments of the present disclosure.

In the above step (2), the at least one preset direction may comprisefour directions of upward direction, downward direction, leftwarddirection, and rightward direction, and the processing terminal may scanthe first processed image in the four directions of upward direction,downward direction, leftward direction, and rightward direction,respectively, and calculate an area of a region which is enclosed by afirst stroke, a second stroke, and scanning lines corresponding to atime when the first stroke is passed through and a time when the secondstroke is reached. In practical applications, the first processed imagemay be equally divided into four scanning regions along a scanningdirection when scanning is performed each time. As shown in FIG. 3, whenscanning is performed downward, the first processed image may be dividedinto four scanning regions iCt1, iCt2, iCt3, and iCt4 along a scanningdirection; and when scanning is performed leftward, the first processedimage may be divided into four scanning regions iCt5, iCt6, iCt7 andiCt8 along a scanning direction. Thereby, after the scanning processesare completed, area values of four sub-regions may be obtained in eachpreset direction, and area values of a total of 16 sub-regions areobtained in four preset directions, that is, a 16-dimensional innercontour feature vector Se2 of the target word may be obtained, and theinner contour feature vector may represent internal structureinformation of the target word. Of course, in step (2), the scanningdirections are not limited to the four directions of upward direction,downward direction, leftward direction, and rightward direction.

In the above step (3), the processing terminal may determine a fontcontour of the target word in the first processed image by using acvFindContours function such as OpenCV, and then determine a fontcontour perimeter by using a cvArcLength function, and the processingterminal may further determine an area enclosed by the font contour,that is, a font area of the target word, by using a cvContourAreafunction, so as to obtain a 2-dimensional perimeter and area featurevector Se3.

In the above step (4), the edge of the first target corrected region isa first edge in the target corrected region along a preset direction.For example, when scanning is performed downward, the edge of the firsttarget corrected region is an upper edge of the target corrected region,and when scanning is performed leftward, the edge of the first targetcorrected region is a right edge of the target corrected region. Theprocessing terminal may perform scanning in four directions of upwarddirection, downward direction, leftward direction, and rightwarddirection respectively, and calculate an area of a region which isenclosed by an edge of a first target corrected region corresponding toeach direction, the first stroke, and scanning lines corresponding to atime when the edge of the first target corrected region is passedthrough and a time when the first stroke is reached. In practicalapplications, the second processed image may be equally divided intofour scanning regions along a scanning direction when scanning isperformed each time. As shown in FIG. 4, when scanning is performeddownward, the second processed image may be divided into four scanningregions Ct1, Ct2, Ct3, and Ct4 along a scanning direction; and whenscanning is performed leftward, the second processed image may bedivided into four scanning regions Ct5, Ct6, Ct7 and Ct8 along ascanning direction. Thereby, after the scanning processes are completed,area values of four sub-regions may be obtained in each presetdirection, and area values of a total of 16 sub-regions are obtained infour preset directions, that is, a 16-dimensional outer contour featurevector Se4 of the target word may be obtained, and the outer contourfeature vector may represent external structure information of thetarget word. Of course, in step (4), the scanning directions are notlimited to the four directions of upward direction, downward direction,leftward direction, and rightward direction.

In addition, an implementation of obtaining a handwriting feature vectoraccording to a product of the writing feature vector and preset weightsmay comprise: calculating a first product of the style feature vectorand a first preset weight, and at least two of a second product of theinner contour feature vector and a second preset weight, a third productof the perimeter and area feature vector and a third preset weight, anda fourth product of the outer contour feature vector and a fourth presetweight, and adding the at least two of the second product, the thirdproduct, and the four product to the first product to obtain thehandwriting feature vector.

Here, different writing feature vectors of the target word may be givendifferent weights. For example, the style feature vector Se1 of thetarget word corresponds to a first preset weight Re1, the inner contourfeature vector Se2 of the target word corresponds to a second presetweight Re2, the perimeter and area feature vector Se3 of the target wordcorresponds to a third preset weight Re3, and the outer contour featurevector Se4 of the target word corresponds to a fourth preset weight Re4,wherein various weights should satisfy a condition that a sum of thefirst preset weight, the second preset weight, the third preset weight,and the fourth preset weight is 1.

When all the four writing feature vectors are included, the handwritingfeature vector of the target word is Ye=Se1*Re1+Se2*Re2+Se3*Re3+Se4*Re4.

In a specific application, the first preset weight, the second presetweight, the third preset weight, and the fourth preset weight may beobtained by fitting a plurality of groups of known style feature vectorsand corresponding handwriting feature vectors. Here, the plurality ofgroups of known style feature vectors and corresponding handwritingfeature vectors may be obtained by calibrating a plurality of groups ofhandwritten target word images.

In step 204, a standard word image is acquired.

In the embodiment of the present disclosure, a large number of images asstandard words to be imitated may be stored in advance in the processingterminal, then the target word in the target word image may beidentified, then a standard word corresponding to the target word isdetermined, and then a standard word image corresponding to the targetword is selected from the stored various images as standard words to beimitated. Of course, in another implementation, a user may manuallyselect a standard word image corresponding to the target word fromvarious images as standard words to be imitated before inputting thestandard word image into the processing terminal. Of course, the usermay also photograph the standard word image corresponding to the targetword, which is not specifically limited in the embodiments of thepresent disclosure.

In step 205, the standard word image is pre-processed to obtain a thirdprocessed image and a fourth processed image.

In the embodiment of the present disclosure, the implementation of thestep is similar to that of pre-processing the target word image in step202, and may comprise: acquiring a standard binarized imagecorresponding to the standard word image; determining, in the standardbinarized image, a standard quadrilateral region comprising the standardword; performing perspective transformation on the standardquadrilateral region to obtain a standard corrected region; performingerosion processing on the standard corrected region to obtain the thirdprocessed image comprising a skeleton of the standard word; andde-noising the standard corrected region to obtain the fourth processedimage.

Here, in the process of performing perspective transformation on thestandard quadrilateral region, not only a distorted viewing angle of thestandard quadrilateral region may be corrected, but also the standardquadrilateral region may be transformed to have the same size as that ofthe target corrected region. Of course, in practical applications, thetarget corrected region may also be transformed to have the same size asthat of the standard quadrilateral region, which is not specificallylimited in the embodiments of the present disclosure.

In step 206, writing feature extraction is performed on the thirdprocessed image and the fourth processed image, to obtain a referencehandwriting feature vector.

In the embodiment of the present disclosure, the implementation of thisstep is similar to that of performing writing feature extraction on thefirst processed image and the second processed image in step 203, andmay comprise: obtaining a style feature vector of the standard word fromthe fourth processed image, obtaining an inner contour feature vector ofthe standard word from the third processed image, obtaining a perimeterand area feature vector of the standard word from the third processedimage, and obtaining an outer contour feature vector of the standardword from the fourth processed image.

Here, a preset weight corresponding to each writing feature vector ofthe target word may be different from that corresponding to each writingfeature vector of the standard word. For example, the style featurevector Ss1 of the standard word corresponds to a fifth preset weightRs1, the inner contour feature vector Ss2 of the standard wordcorresponds to a sixth preset weight Rs2, the perimeter and area featurevector Ss3 of the standard word corresponds to a seventh preset weightRs3, and the outer contour feature vector Ss4 of the standard wordcorresponds to an eighth preset weight Rs4, wherein various weightsshould satisfy a condition that a sum of the fifth preset weight, thesixth preset weight, the seventh preset weight, and the eighth presetweight is 1. When all the four writing feature vectors are included, thereference handwriting feature vector of the standard word isYs=Ss1*Rs1+Ss2*Rs2+Ss3*Rs3+Ss4*Rs4.

In a specific application, the fifth preset weight, the sixth presetweight, the seventh preset weight, and the eighth preset weight may beobtained by fitting a plurality of groups of known style feature vectorsand corresponding reference handwriting feature vectors. Here, theplurality of groups of known style feature vectors and correspondingreference handwriting feature vectors may be obtained by calibrating aplurality of groups of standard word images.

It should be illustrated that, in practical applications, step 204 tostep 206 may be performed after step 203, or may be performed beforestep 201, or step 201 and step 204 may be performed at the same time,step 202 and step 205 may be performed at the same time, and step 203and step 206 may be performed at the same time, which is not limitedspecifically in the embodiments of the present disclosure.

In step 207, a difference parameter (or similarity) between thehandwriting feature vector and the reference handwriting feature vectorcorresponding to the standard word image is determined.

In a specific application, the difference parameter may comprise aEuclidean distance or a Mahalanobis distance. For example, theprocessing terminal may determine a Euclidean distance d=|Ys−Ye| betweenthe first feature vector Ye and the second feature vector Yscorresponding to the standard word image. Further, in some embodiments,the similarity may be given based on the difference parameter. Forexample, the similarity may be a reciprocal of the difference parameter,a cosine similarity between feature vectors, or a Jaccard similaritybetween sets, etc., and the present disclosure is not limited thereto.

In step 208, a writing quality level corresponding to the differenceparameter is determined.

By taking the difference parameter being a Euclidean distance as anexample, the processing terminal may store four writing quality levels,i.e., “excellent”, “good”, “general” and “poor”, and Euclidean distanceranges corresponding to various writing quality levels in advance. Afterthe processing terminal determines a Euclidean distance d between afirst feature vector and a second feature vector, a Euclidean distancerange Dl to which the Euclidean distance d belongs may be determined,and thereby a writing quality level corresponding to the Euclideandistance range D1 is determined to be “excellent”, which indicates thatthe target word is very similar to the standard word, that is, the userwrites a quite standard target word. In some other embodiments, thewriting quality level may also be determined according to thesimilarity, which will not be described in detail here due to anintuitive negative correlation relationship between the distance(difference) parameter and the similarity.

In the embodiment of the present disclosure, after the processingterminal acquires the target word image, the processing terminal mayfirstly pre-process the target word image to obtain the first processedimage and the second processed image, then perform writing featureextraction on the first processed image and the second processed image,to obtain the handwriting feature vector, and then may determine thereference handwriting feature vector corresponding to the standard wordimage, so as to determine the difference parameter or similarity betweenthe handwriting feature vector and the reference handwriting featurevector, and determine the writing quality level corresponding to thedifference parameter or similarity. In the embodiment of the presentdisclosure, the processing terminal may extract writing features of thetarget word image and compare the writing features of the target wordimage with writing features of the standard word image, so as todetermine a writing quality level of the target word image relative tothe standard word image. In this way, the processing terminal maydetermine a quality level of a written font of a calligraphypractitioner, so as to provide professional guidance to the calligraphypractitioner, thereby improving the efficiency of the calligraphypractice.

FIG. 5 illustrates a schematic structural diagram of an apparatus fordetermining a quality level of a written font based on a handwritingsimilarity according to still another embodiment of the presentdisclosure. As shown in FIG. 5, the apparatus 500 may comprise:

a first acquisition module 501, configured to acquire a target wordimage;

a first pre-processing module 502, configured to pre-process the targetword image to obtain a first processed image and a second processedimage;

a first extraction module 503, configured to perform writing featureextraction on the first processed image and the second processed image,to obtain a handwriting feature vector;

a first determination module 504, configured to determine a differenceparameter between the handwriting feature vector and a referencehandwriting feature vector corresponding to a standard word image; and

a second determination module 505, configured to determine a writingquality level corresponding to the difference parameter.

In some embodiments, as shown in FIG. 5, the apparatus 500 furthercomprises:

a second acquisition module 506, configured to acquire the standard wordimage;

a second pre-processing module 507, configured to pre-process thestandard word image to obtain a third processed image and a fourthprocessed image; and

a second extraction module 508, configured to perform writing featureextraction on the third processed image and the fourth processed image,to obtain a reference handwriting feature vector.

In some embodiments, as shown in FIG. 5, the first pre-processing module502 comprises:

an acquisition sub-module 5021, configured to acquire a target binarizedimage corresponding to the target word image;

a determination sub-module 5022, configured to determine, in the targetbinarized image, a target quadrilateral region comprising a target word;

a transformation sub-module 5023, configured to perform perspectivetransformation on the target quadrilateral region to obtain a targetcorrected region;

an erosion sub-module 5024, configured to perform erosion processing onthe target corrected region to obtain the first processed imagecomprising a skeleton of the target word; and

a de-noising sub-module 5025, configured to de-noise the targetcorrected region to obtain the second processed image.

In some embodiments, as shown in FIG. 5, the first extraction module 503comprises:

an extraction sub-module 5031, configured to perform writing featureextraction on the first processed image and the second processed imageto obtain a writing feature vector;

a calculation sub-module 5032, configured to obtain the handwritingfeature vector according to a product of the writing feature vector andpreset weights.

Here, the writing feature vector comprises a style feature vector and atleast two of an inner contour feature vector, a perimeter and areafeature vector, and an outer contour feature vector.

In some embodiments, as shown in FIG. 6, the extraction sub-module 5031comprises:

an extraction unit 50311, configured to extract a font style feature ofthe second processed image based on a convolutional neural network, toobtain the style feature vector; and

at least two of:

a first determination unit 50312, configured to determine, from thefirst processed image, an area of a region between a first stroke and asecond stroke in at least one preset direction, to obtain the innercontour feature vector;

a second determination unit 50313, configured to determine a fontcontour perimeter and a font area of the first processed image, toobtain the perimeter and area feature vector;

a third determination unit 50314, configured to determine, from thesecond processed image, an area of a region between an edge of a firsttarget corrected region and the first stroke in at least one presetdirection to obtain the outer contour feature vector.

In the embodiment of the present disclosure, after the processingterminal acquires the target word image through the first acquisitionmodule, the processing terminal may firstly pre-process the target wordimage through the first pre-processing module to obtain the firstprocessed image and the second processed image, and then perform writingfeature extraction on the first processed image and the second processedimage through the first extraction module to obtain the handwritingfeature vector, so as to determine the difference parameter between thehandwriting feature vector and the reference handwriting feature vectorcorresponding to the standard word image through the first determinationmodule, and determine the writing quality level corresponding to thedifference parameter through the second determination module. In theembodiment of the present disclosure, the processing terminal mayextract writing features of the target word image and compare thewriting features of the target word image with writing features of thestandard word image, so as to determine a writing quality level of thetarget word image relative to the standard word image. In this way, theprocessing terminal may determine a quality level of a written font of acalligraphy practitioner, so as to provide professional guidance to thecalligraphy practitioner, thereby improving the efficiency of thecalligraphy practice.

FIG. 7 is schematic diagram of a hardware arrangement 700 fordetermining a handwriting similarity according to an embodiment of thepresent disclosure. The hardware arrangement 700 comprises a processor706 (for example, a Digital Signal Processor (DSP), a Central ProcessingUnit (CPU), etc.) The processor 706 may be a single processing unit or aplurality of processing units for performing different actions of theflow described herein. The arrangement 700 may also comprise an inputunit 702 for receiving signals from other entities, and an output unit704 for providing signals to other entities. The input unit 702 and theoutput unit 704 may be arranged as a single entity or separate entities.

In addition, the arrangement 700 may comprise at least one readablestorage medium 708 in a form of non-volatile or volatile memory, such asan Electrically Erasable Programmable Read-Only Memory (EEPROM), a flashmemory, and/or a hard disk driver. The readable storage medium 708comprises a computer program 710 which includes codes/computer readableinstructions that, when executed by the processor 706 in the arrangement700, cause the hardware arrangement 700 and/or the device including thehardware arrangement 700 to perform, for example, flows described abovein connection with FIG. 1 or 2 and any variations thereof.

The computer program 710 may be configured with computer program codeshaving, for example, architecture of computer program modules 710A-710E.Therefore, in an example embodiment when the hardware arrangement 700 isused in the mobile terminal, the codes in the computer program of thearrangement 700 may comprise a module 710A for performing imageprocessing on a handwriting image comprising a handwriting to becompared to obtain a first processed image and a second processed imagehaving different writing features of the handwriting image; a module710B for determining, based on the first processed image, a firstfeature vector indicating at least one first handwriting feature of thehandwriting to be compared; a module 710C for determining, based on thesecond processed image, a second feature vector indicating at least onesecond handwriting feature of the handwriting to be compared; a module710D for determining a handwriting feature vector of the handwriting tobe compared based at least on the first feature vector and the secondfeature vector; and a module 710E for determining a similarity betweenthe handwriting to be compared and a reference handwriting based on thehandwriting feature vector and a reference handwriting feature vector ofthe reference handwriting . . .

The computer program modules may substantially perform the variousactions in the flow shown in FIG. 1 or 2 to simulate the device fordetermining a handwriting similarity. In other words, when differentcomputer program modules are executed in the processor 706, they maycorrespond to different units or modules in the device for determining ahandwriting similarity.

Although the code means in the embodiments disclosed above inconjunction with FIG. 7 are implemented as computer program modulesthat, when executed in the processor 706, cause the hardware arrangement700 to perform the actions described above in connection with FIG. 1 or2, in alternative embodiments, at least one of the code means may beimplemented at least in part as a hardware circuit.

The processor may be a single Central Processing Unit (CPU), but mayalso comprise two or more processing units. For example, the processormay comprise a general purpose microprocessor, an instruction setprocessor, and/or a related chipset and/or a dedicated microprocessor(for example, an Application Specific Integrated Circuit (ASIC)). Theprocessor may also comprise an on-board memory for caching purposes. Thecomputer program may be carried by a computer program product connectedto the processor. The computer program product may comprise acomputer-readable medium having stored thereon a computer program. Forexample, the computer program product may be a flash memory, a RandomAccess Memory (RAM), a Read Only Memory (ROM), and an EEPROM, and thecomputer program module may, in an alternative embodiment, bedistributed to different computer program products in a form of memorywithin the device.

For the above method embodiments, for the sake of brevity, they are alldescribed as combinations of a series of actions, but it should beunderstood by those skilled in the art that the present disclosure isnot limited by an order of actions described, since according to thepresent disclosure, some steps may be performed in other orders or atthe same time. In addition, it should also be understood by thoseskilled in the art that the embodiments described in the presentspecification are all preferred embodiments, and actions and modulesinvolved are not necessarily required by the present disclosure.

Various embodiments in the present specification are described in aprogressive manner, each embodiment focuses on differences from otherembodiments, and the same or similar parts between the variousembodiments may be known with reference to each other.

Finally, it should also be illustrated that relational terms such as“first”, “second” etc. herein are merely used to distinguish one entityor operation from another entity or operation, and do not necessarilyrequire or imply that there is any such actual relationship or orderbetween these entities or operations. Further, the terms “comprises” or“comprising” or any other variations thereof are intended to encompass anon-exclusive inclusion, so that a process, method, commodity, or devicecomprising a series of elements not only comprises these elements, butalso comprises other elements which are not explicitly listed, or mayfurther comprise elements inherent to such a process, method, commodity,or device. Unless otherwise restricted, an element defined by a phrase“comprising a . . .” does not exclude the presence of additionalequivalent elements in a process, method, commodity, or devicecomprising the element.

The method, device, and non-transitory computer readable storage mediumfor determining a handwriting similarity according to the presentdisclosure have been described in detail above. Specific examples areapplied herein to explain the principles and implementations of thepresent disclosure. The above description of the embodiments is only forfacilitating understanding the method according to the presentdisclosure and its core idea; at the same time, changes may be made tothe specific implementations and application scopes by those of ordinaryskill in the art according to the idea of the present disclosure. Inconclusion, the contents of the present specification are not to beconstrued as limiting the present disclosure.

I/we claim:
 1. A computer implemented method for determining ahandwriting similarity, the method comprising: performing imageprocessing on a handwriting image comprising a handwriting to becompared to obtain a first processed image and a second processed imagehaving different handwriting features of the handwriting image;determining, based on the first processed image, a first feature vectorindicating at least one first handwriting feature of the handwriting tobe compared; determining, based on the second processed image, a secondfeature vector indicating at least one second handwriting feature of thehandwriting to be compared; determining a handwriting feature vector ofthe handwriting to be compared based at least on the first featurevector and the second feature vector; and determining a similaritybetween the handwriting to be compared and a reference handwriting basedon the handwriting feature vector and a reference handwriting featurevector of the reference handwriting.
 2. The method according to claim 1,wherein the step of determining a similarity between the handwriting tobe compared and a reference handwriting based on the handwriting featurevector and a reference handwriting feature vector of the referencehandwriting comprises: determining a distance parameter between thehandwriting feature vector and the reference handwriting feature vector;and determining the similarity between the handwriting to be comparedand the reference handwriting based on the distance parameter.
 3. Themethod according to claim 2, wherein the distance parameter comprises aEuclidean distance or a Mahalanobis distance between the vectors.
 4. Themethod according to claim 1, wherein the reference handwriting featurevector of the reference handwriting is determined by: performing imageprocessing on the reference handwriting image comprising the referencehandwriting to obtain a third processed image and a fourth processedimage having different handwriting features of the reference handwritingimage; determining, based on the third processed image, a third featurevector indicating a corresponding first handwriting feature of thereference handwriting; determining, based on the fourth processed image,a fourth feature vector indicating a corresponding second handwritingfeature of the reference handwriting; and determining a referencehandwriting feature vector of the reference handwriting based at leaston the third feature vector and the fourth feature vector.
 5. The methodaccording to claim 1, wherein the step of performing image processing ona handwriting image comprising a handwriting to be compared to obtain afirst processed image and a second processed image having differenthandwriting features of the handwriting image comprise: converting thehandwriting image into a corresponding binarized handwriting image;determining, in the binarized handwriting image, a quadrilateral regioncomprising the handwriting to be compared; performing perspectivetransformation on the quadrilateral region to obtain a corrected region;performing erosion processing on the corrected region to obtain thefirst processed image comprising a skeleton of the handwriting to becompared; and de-noising the corrected region to obtain the secondprocessed image.
 6. The method according to claim 1, wherein the step ofdetermining a handwriting feature vector of the handwriting to becompared based at least on the first feature vector and the secondfeature vector comprises: determining a weighted sum of the firstfeature vector and the second feature vector based on preset weights, asthe handwriting feature vector.
 7. The method according to claim 6,wherein the first feature vector comprises at least one of an innercontour feature vector and a perimeter and area feature vector.
 8. Themethod according to claim 6, wherein the second feature vector comprisesat least one of an outer contour feature vector and a style featurevector.
 9. The method according to claim 7, wherein the step ofdetermining, based on the first processed image, a first feature vectorindicating at least one first handwriting feature of the handwriting tobe compared comprises at least one of: determining, from the firstprocessed image, an area of a region between a first stroke and a secondstroke in at least one preset direction as the inner contour featurevector; or determining a font contour perimeter and a font area of thefirst processed image to obtain the perimeter and area feature vector.10. The method according to claim 8, wherein the step of determining,based on the second processed image, a second feature vector indicatingat least one second handwriting feature of the handwriting to becompared comprises at least one of: extracting a font style feature ofthe second processed image based on a convolutional neural network toobtain the style feature vector; or determining, from the secondprocessed image, an area of a region between an edge of a first targetcorrected region and a first stroke in at least one of the presetdirections to obtain the outer contour feature vector.
 11. A device fordetermining a handwriting similarity, the device comprising: aprocessor; and a memory having stored thereon instructions which, whenexecuted by the processor, cause the processor to: perform imageprocessing on a handwriting image comprising a handwriting to becompared to obtain a first processed image and a second processed imagehaving different handwriting features of the handwriting image;determine, based on the first processed image, a first feature vectorindicating at least one first handwriting feature of the handwriting tobe compared; determine, based on the second processed image, a secondfeature vector indicating at least one second handwriting feature of thehandwriting to be compared; determine a handwriting feature vector ofthe handwriting to be compared based on the first feature vector and thesecond feature vector at least; and determine a similarity between thehandwriting to be compared and a reference handwriting based on thehandwriting feature vector and a reference handwriting feature vector ofthe reference handwriting.
 12. The device according to claim 11, whereinthe instructions, when executed by the processor, further cause theprocessor to: determine a distance parameter between the handwritingfeature vector and the reference handwriting feature vector; anddetermine the similarity between the handwriting to be compared and thereference handwriting based on the distance parameter.
 13. The deviceaccording to claim 12, wherein the distance parameter comprises aEuclidean distance or a Mahalanobis distance between the vectors. 14.The device according to claim 11, wherein the instructions, whenexecuted by the processor, further cause the processor to: perform imageprocessing on the reference handwriting image comprising the referencehandwriting to obtain a third processed image and a fourth processedimage having different handwriting features of the reference handwritingimage; determine, based on the third processed image, a third featurevector indicating a corresponding first handwriting feature of thereference handwriting; determine, based on the fourth processed image, afourth feature vector indicating a corresponding second handwritingfeature of the reference handwriting; and determine a referencehandwriting feature vector of the reference handwriting based at leaston the third feature vector and the fourth feature vector.
 15. Thedevice according to claim 11, wherein the instructions, when executed bythe processor, further cause the processor to: convert the handwritingimage into a corresponding binarized handwriting image; determine, inthe binarized handwriting image, a quadrilateral region comprising thehandwriting to be compared; perform perspective transformation on thequadrilateral region to obtain a corrected region; perform erosionprocessing on the corrected region to obtain the first processed imagecomprising a skeleton of the handwriting to be compared; and de-noisethe corrected region to obtain the second processed image.
 16. Thedevice according to claim 11, wherein the instructions, when executed bythe processor, further cause the processor to: determine a weighted sumof the first feature vector and the second feature vector based onpreset weights, as the handwriting feature vector.
 17. The deviceaccording to claim 16, wherein the first feature vector comprises atleast one of an inner contour feature vector and a perimeter and areafeature vector.
 18. The device according to claim 16, wherein the secondfeature vector comprises at least one of an outer contour feature vectorand a style feature vector.
 19. The device according to claim 17,wherein the instructions, when executed by the processor, further causethe processor to perform at least one of: determining, from the firstprocessed image, an area of a region between a first stroke and a secondstroke in at least one preset direction as the inner contour featurevector; or determining a font contour perimeter and a font area of thefirst processed image to obtain the perimeter and area feature vector.20. A non-transitory computer readable storage medium, having storedthereon a computer program which, when executed by a processor,implements the steps of the method according to claim 1.